﻿using Ec_System.Bll.Web;
using Ec_System.Models.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ec_System.Cache.Web;

namespace Ec_System.Facade.Web
{
    public class QrCodeFacade
    {
        QrCodeManager qrCodeManager = new QrCodeManager();
        /// <summary>
        /// 根据溯源码获取Product的溯源信息
        /// </summary>
        /// <param name="code">溯源码</param>
        /// <param name="ip"></param>
        /// <returns></returns>
        public QrCodeData GetQrInfoByCode(string code, string ip)
        {
            var model =  QrCodeManager.GetQrInfoByCode(code, ip);
            if(!model.IsNull)
            {
                //添加Product名字
                model.ProductName = new ShopCartCache().GetProductInfoByID(int.Parse(model.ProductID)).ShopProductTitle;
            }
            return model;
        }
    }
}
